package com.hd.service;

import java.util.Date;
import java.util.List;

import com.hd.common.DataPage;
import com.hd.persistence.model.Customer;
import com.hd.persistence.model.MachineInfo;
import com.hd.persistence.model.PurchaseRecord;
import com.hd.utils.HdException;

/** 提供购买机器需要的增、删、查、改方法，主要有客户、购买记录、机器信息
 * @author Administrator
 *
 */
public interface PurchaseManager {
	
	////////////////////客户档案////////////////////
	
	/** 保存、更新实体
	 * @param customer
	 * @throws HdException
	 */
	public void saveCustomer(Customer customer) throws HdException;
	
	/** 根据标识删除实体
	 * @param customerId
	 * @throws HdException
	 */
	public void deleteCustomer(Long customerId) throws HdException;
	
	/** 根据标识获取实体
	 * @param customerId
	 * @return
	 * @throws HdException
	 */
	public Customer getCustomer(Long customerId) throws HdException;
	
	/** 分页查询客户
	 * @param pageNo 一个int，起始页，从1开始
	 * @param pageSize
	 * @return
	 * @throws HdException
	 */
	public DataPage<Customer> pageQueryCustomers(int pageNo, int pageSize) throws HdException;
	
	
	/**列出所有客户
	 * @return
	 * @throws HdException
	 */
	public List<Customer> listCustomers() throws HdException;
	
	/** 根据条件分页查询客户信息
	 * @param customerId
	 * @param contractStartDate
	 * @param contractEndDate
	 * @param machineModel
	 * @param pageNo
	 * @param pageSize
	 * @return
	 * @throws HdException
	 */
	public DataPage<Customer> pageQueryCustomers(Long customerId, Date contractStartDate, Date contractEndDate, String machineModel, int pageNo, int pageSize) throws HdException;
	
	////////////////////购买记录////////////////////
	
	/** 保存、更新实体
	 * @param purchaseRecord
	 * @throws HdException
	 */
	public void savePurchaseRecord(PurchaseRecord purchaseRecord) throws HdException;
	
	/** 根据标识删除实体
	 * @param purchaseRecordId
	 * @throws HdException
	 */
	public void deletePurchaseRecord(Long purchaseRecordId) throws HdException;
	
	/** 根据标识获取实体
	 * @param purchaseRecordId
	 * @return
	 * @throws HdException
	 */
	public PurchaseRecord getPurchaseRecord(Long purchaseRecordId) throws HdException;
	
	/** 分页查询购买记录
	 * @param pageNo 一个int，从1开始
	 * @param pageSize
	 * @return
	 * @throws HdException
	 */
	public DataPage<PurchaseRecord> pageQueryPurchaseRecords(int pageNo, int pageSize) throws HdException;
	
	
	/**根据机器序号查找购买记录
	 * @param machionId(机器ID)
	 * @return
	 * @throws HdException
	 */
	public PurchaseRecord findPurchaseRecordBy(String machineNO) throws HdException;
	
	/** 根据条件分页查询
	 * @param customerId
	 * @param contractStartDate
	 * @param contractEndDate
	 * @param machineModel
	 * @param pageNo
	 * @param pageSize
	 * @return
	 * @throws HdException
	 */
	public DataPage<PurchaseRecord> pageQueryPurchaseRecords(Long customerId, Date contractStartDate, Date contractEndDate, String machineModel, int pageNo, int pageSize) throws HdException;
	
	////////////////////购买的机器信息////////////////////
	
	/** 保存、更新实体
	 * @param machineInfo
	 * @throws HdException
	 */
	public void saveMachineInfo(MachineInfo machineInfo) throws HdException;
	
	/** 根据标识删除实体
	 * @param machineInfoId
	 * @throws HdException
	 */
	public void deleteMachineInfo(Long machineInfoId) throws HdException;
	
	/** 根据标识获取实体
	 * @param machineInfoId
	 * @return
	 * @throws HdException
	 */
	public MachineInfo getMachineInfo(Long machineInfoId) throws HdException;
	
	/** 分页查询机器信息
	 * @param pageNo 一个int，从1开始
	 * @param pageSize
	 * @return
	 * @throws HdException
	 */
	public DataPage<MachineInfo> pageQueryMachineInfos(int pageNo, int pageSize) throws HdException;
	
	
}
